1. Field of the Invention
The present invention relates to an encoding device and a decoding device for transferring data seamlessly without resetting and without any underflow or overflow even when the transfer rate is changed, a broadcasting system including such encoding and decoding devices, and a data storage medium having data obtained by such an encoding device.
2. Description of the Related Art
One format for encoding an audio signal is MPEG2-AAC (Advanced AudioCodec) format. A transmitter for transmitting data (i.e., bit streams) encoded by MPEG2-AAC includes an MPEG2-AAC encoder, and a receiver for receiving the data includes an MPEG2-AAC decoder.
In the MPEG2-AAC encoder, the amount of bit streams generated in each of a plurality of frame time periods (i.e., frame length) is variable, but the transfer rate is constant. Accordingly, in order to transfer all the bit streams generated, the transmitter is required to include an output buffer for storing bit streams, so that the bit streams which cannot be transferred in one frame time period remain in the output buffer. The bit streams remaining in the output buffer are sequentially transferred in the subsequent frame time periods. In order to realize such transfer of bit streams, the amount of the bit streams generated in each frame time period by an encoder is controlled so that the sum of the amount of the bit streams generated in each frame time period and the amount of the bit stream remaining in the output buffer is equal to or greater than the amount corresponding to the transfer rate and equal to or less than the maximum transfer rate.
Such a function of the MPEG2-AAC format is referred to as the “bit reserver”. The bit reserver eliminates the necessity of restricting the amount of the bit streams generated in each frame time period in accordance with the transfer rate. Even when the transfer rate is relatively low, the amount of bit streams which is equal to or greater than the amount corresponding to the transfer rate can be generated. Accordingly, an encoder having such a function can provide a higher sound quality as compared to a conventional encoder having the amount of bit stream generated fixed.
FIG. 9 is a graph illustrating an over-time change in the amount of bit streams in a conventional MPEG2-AAC encoder having a maximum possible transfer rate of 288 kbps. In the example shown in FIG. 9, the bit streams are transferred at the rate of 32 kbps.
The vertical axis represents the amount of bit streams generated by the encoder, and the horizontal axis represents the time. Solid line 91 represents the change in the amount to of the bit streams in the encoder. An increase in the bit stream amount in the vertical direction represents generation of the bit streams by an encoder, and a decrease in the bit stream amount in the horizontal direction represents transfer of the bit streams.
In order to receive the bit streams which are generated and transferred in this manner, the receiver having the MPEG2-AAC decoder includes an input buffer. When the bit receiver is used, an underflow in the input buffer, in the decoder needs to be prevented.
FIG. 10 is a graph illustrating an over-time change in the amount of bit streams in a conventional MPEG2-AAC decoder. In the example shown in FIG. 10, the bit streams transferred from the encoder described in relation to FIG. 9 are processed by the decoder with a delay amount of 1. Herein, the term “delay amount of 1” is defined to mean that the time period elapsed between the generation of the data by the encoder and the consumption (i.e., decoding) of the data by the decoder is 1 frame. In FIG. 10, an increase in the bit stream amount in the horizontal direction represents transfer of the bit streams, and a decrease in the bit stream amount in the vertical direction represents consumption of the bit streams by the decoder.
When the bit streams transferred from the encoder described in relation to FIG. 9 are decoded by the decoder with a delay amount of 1 as shown in FIG. 10, an underflow occurs. Although not shown, the same is true when the transfer is performed with a delay amount of 2.
In the example shown in FIG. 9, bit streams corresponding to the transfer rate of 288 kbps can be generated when the transfer rate is 32 kbps. In order to allow the decoder to decode the bit streams corresponding to the rate of 288 kbps, a delay amount of 288 kbps/32 kbps=9 frame time periods is required.
FIG. 11A is a graph illustrating an over-time change in the amount of bit streams in another conventional MPEG2-AAC encoder having a maximum possible transfer rate of 288 kbps. FIG. 11B is a graph illustrating an over-time change in the amount of bit streams in another conventional MPEG2-AAC decoder. In the example shown in FIG. 11B, the bit streams generated and transferred as shown in FIG. 11A are decoded by the decoder with a delay amount of 9. In order to prevent an underflow, the bit streams are generally required to be temporarily stored in the input buffer in the decoder before the decoding is started. In the example shown in FIG. 11B, the underflow is prevented by storing the bit streams corresponding to the rate of 288 kbps in the input buffer before the decoding is started.
Even after the decoding is started, it is also necessary to prevent an underflow and an overflow in the input buffer of the decoder when the transfer rate is changed.
FIG. 12 is a graph illustrating an over-time change in the amount of bit streams in still another conventional MPEG2-AAC decoder. In the example shown in FIG. 12, the transfer rate is changed from 32 kbps to 288 kbps at the point represented by arrow 121. At the time of the change, an overflow occurs in the input buffer of the decoder because a required delay amount is changed when the transfer rate is changed.
In order to avoid such an overflow, the input buffer in the decoder needs to have a size corresponding to 288 kbps×9, and the delay amount needs to be constant regardless of the transfer rate. Alternatively, the encoder needs to temporarily stop encoding when the transfer rate is changed to empty the output buffer and restart encoding after the decoder decodes all the bit streams. In such a case, the decoder restarts decoding after the bit streams corresponding to 288 kbps are stored in the input buffer after the encoder restarts encoding. This system is described in detail in Japanese Laid-Open Publication No. 10-374272 entitled “Encoding Device and Decoding Device”.
In a conventional data transfer system, an encoding device from which data is transferred and a decoding device to which the data is transferred both include a reset device for resetting encoding and decoding when a transfer condition such as the transfer rate is changed. Accordingly, in order to avoid resetting from being performed simultaneously with program reproduction, the data to be transferred includes a sufficient time duration of a silent portion.
The above-described encoding device and decoding device for solving the overflow and underflow involve problems such that seamless processing is impossible, the buffer amount significantly increases, and the delay amount is excessively large.
When the input buffer in the decoder has a size corresponding to maximum transfer rate×delay amount, the capacity of the input buffer is significantly increased. When the delay amount is made constant regardless of the transfer rate, the delay amount becomes excessively larger. When the encoding is temporarily stopped when the transfer rate is changed, the interruption in the processing prevents seamless processing.
In the above-mentioned conventional data transfer system, whenever the transfer rate is changed, resetting needs the be performed, which inconveniently requires the parameter changes in the encoding and decoding to be communicated to the encoding device and the decoding device beforehand.
Since the time duration from the start to termination of resetting (reset time) varies depending on each individual encoding device or decoding device, the data transfer system sets the reset time sufficiently long in consideration of the device-to-device dispersion in the reset time. As a result, the data to be transferred includes an unnecessarily long silent portion.
Moreover, in the above-mentioned conventional data transfer system, the decoding device forcibly clears the bit streams which have not been decoded when resetting is performed. In order to avoid this, the encoding device needs to insert bit streams corresponding to a silent signal into the audio signal bit streams for a sufficiently long time duration from before the start until after the termination of resetting.